<!DOCTYPE html>
<html>

	<head>
		<meta charset="UTF-8">
		<title>JQuery处理动画</title>
		<link rel="stylesheet" type="text/css" href="css/txt.css" />
		<script src="js/jquery.js" type="text/javascript" charset="utf-8"></script>
	</head>

	<body>
		<div id="mypic" style="position: absolute;"><img src="img/ball.png"></div>
	</body>

	<script type="text/javascript">
		$(function() {
			// 请使用animate函数实现皮球5秒钟向右滚动800px，之后5秒钟又回到原来的位置
			moveR(); //开始左右移动
			function moveR(){
				$("#mypic").animate({"left":"800px"},5000,moveL);
				
			}
			function moveL(){
				$("#mypic").animate({"left":"0px"},5000,moveR);
			}
		});
	</script>

</html>